<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/9
 * Time: 10:34
 */

namespace app\api\controller;

use app\api\ApiBase;
use think\db;

class UserReport extends ApiBase
{
    /**
     * 用户举报
     *
     * @return string|void
     */
    public function add_report()
    {
        $data = array();
        $data['user_id'] = $this->user_info['id'];//用户id（测试）
        $data['report_user_id'] = input('report_user_id');
        $data['pk_id'] = input('pk_id');
        $data['report_text'] = input('report_text');
        $data['create_time'] = time();
        $res = db('user_report')->insertGetId($data);
        if ($res){
            return $this->json_return('1','举报成功！');
        }else{
            return $this->json_error('举报失败！');
        }
    }
}